// 获取权限 scope
export const getSetting = () => {
  return new Promise((resove, reject) => {
    wx.getSetting({
      success: (result)=>{
        resove(result)
      },
      fail: (error)=>{
        reject(error)
      }
    })
  })
}
// 选择地址
export const chooseAddress = () => {
  return new Promise((resove, reject) => {
    wx.chooseAddress({
      success: (result)=>{
        resove(result)
      },
      fail: (error)=>{
        reject(error)
      }
    })
  })
}
// 重新授权 （可获取地址胡
export const openSetting = () => {
  return new Promise((resove, reject) => {
    wx.openSetting({
      success: (result)=>{
        resove(result)
      },
      fail: (error)=>{
        reject(error)
      }
    })
  })
}

// 提示框
export const showToast = (title) => {
  return new Promise((resove, reject) => {
    wx.showToast({
      title: title,
      icon: 'none',
      success: (result)=>{
        resove(result)
      },
      fail: (err)=>{
        reject(err)
      }
    });
  })
}
// login
export const login = () => {
  return new Promise((resove, reject) => {
    wx.login({
      timeout:10000,
      success: (result)=>{
        resove(result.code)
      }
    });
  })
}
export const requestPayment = (pay) => {
  return new Promise((resove, reject) => {
    wx.requestPayment({
      ...pay,
      success: (result)=>{
        resove(result)
      },
      fail: (err)=>{
        reject(err)
      },
      complete: ()=>{}
    });
  })
}